<template>
	<view class="pl-30 pr-30">
		<view class="bg-white mt-10">
			<view class="padding-30 border-b">{{cardData.cardItemName}}</view>
			<view class="flex padding-30 border-b">
				<text class="mr-30">退款金额</text>
				<u-input v-model="cardData.refundAmount" placeholder="请输入退款金额" border="none" type="number" />
			</view>
			<view class="flex padding-30" @click="showType = true">
				<text class="mr-30">退款方式</text>
				<u-input v-model="cardData.paymentName" disabled disabledColor="#fff" border="none">
					<template slot="suffix">
						<u-icon size="16" name="arrow-right" color="#aaa"/>
					</template>
				</u-input>
			</view>
		</view>
		<view class="padding-60">
			<u-button text="确定" color="#e54d42" @click="onSubmit"></u-button>
		</view>
		<u-picker :show="showType" :columns="payColumns" keyName="label" @confirm="onSelectPayType" @cancel="showType=false"/>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data(){
			return {
				showType: false,
				date:Number(new Date()),
				cardData:{
					orderType: 12,
					paymentName:'微信支付',
					paymentCode: 'wechatpay',
					refundAmount: null,
					orderId:null,
				},
				payColumns:[[
					{label:'微信支付', value: 'wechatpay', },
					{label:'支付宝支付', value: 'alipay'},
					{label:'线下支付', value: 'offline'},
					{label:'余额支付', value: 'balancepay'},
					{label:'股本消费', value: 'stockpay'},
				]],
				
			}
		},
		onLoad(opt) {
			this.cardData.orderId = opt.orderId
			this.cardData.cardItemName = opt.cardItemName
		},
		methods: {
			onSelectPayType(e){
				this.cardData.paymentName = e.value[0].label
				this.cardData.paymentCode = e.value[0].value
				this.showType = false
			},
			onSubmit(){
				this.$reqJsonPost('ProjectOrderDoRefund', this.cardData).then(res=>{
					this.$refs.uToast.show({
						message: res.msg,
						complete(){
							uni.$emit('uplist', 0)
							uni.navigateBack()
						}
					})
				})
			}
		}
	}
</script>

<style>
</style>